package cn.iocoder.yudao.module.blog.dal.mysql.improvechapter;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.blog.dal.dataobject.improvechapter.BlogImproveChapterDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.blog.controller.admin.improvechapter.vo.*;

/**
 * 课程章节 Mapper
 *
 * @author 曹建伟
 */
@Mapper
public interface BlogImproveChapterMapper extends BaseMapperX<BlogImproveChapterDO> {

    default PageResult<BlogImproveChapterDO> selectPage(BlogImproveChapterPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BlogImproveChapterDO>()
                .eqIfPresent(BlogImproveChapterDO::getImproveId, reqVO.getImproveId())
                .likeIfPresent(BlogImproveChapterDO::getName, reqVO.getName())
                .eqIfPresent(BlogImproveChapterDO::getSort, reqVO.getSort())
                .betweenIfPresent(BlogImproveChapterDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BlogImproveChapterDO::getId));
    }

    default List<BlogImproveChapterDO> selectList(BlogImproveChapterExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<BlogImproveChapterDO>()
                .eqIfPresent(BlogImproveChapterDO::getImproveId, reqVO.getImproveId())
                .likeIfPresent(BlogImproveChapterDO::getName, reqVO.getName())
                .eqIfPresent(BlogImproveChapterDO::getSort, reqVO.getSort())
                .betweenIfPresent(BlogImproveChapterDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BlogImproveChapterDO::getId));
    }

}
